package com.water.web;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServletResponse;
/**
 * 工具类
 * @author whl
 *
 */
public class Tool {

	/**
	 * JSON格式输出到页面
	 * @param text
	 * @param response
	 */
	public static void writeByAction(String text, HttpServletResponse response) {
		response.setContentType("text/plain;charset=UTF-8");
		response.setHeader("Cache-Control", "no-cache");
		PrintWriter pw = null;
		try {
			pw = response.getWriter();
			pw.write(text);
			pw.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
